package shortcode

import (
	"math/rand"
	"time"
)


type ShortCoder interface{
	GeratorShortCode(length int) string
}
type ShortCode struct{
}
func NewShortCode() *ShortCode {
	return &ShortCode{}
}
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

var seededRand *rand.Rand = rand.New(rand.NewSource(time.Now().UnixNano()))

func (s *ShortCode) GeratorShortCode(length int) string{
	b := make([]byte,length)
	for i:= range b{
		b[i] = charset[seededRand.Intn(len(charset))]
	}
	return string(b)

}